<template>
    <div class="">
        <div class="pr10">
            <div class="analyItem">
                <p class="analyItemTit tx-center">状态</p>
                <div class="analyItemCon">
                    <p class="col-md-4 ">
                        <span class="cLightGray pr8">总个数</span>
                        <span>{{orderNum}}</span>
                    </p>
                    <p class="col-md-4 ">
                        <span class="cLightGray pr8">总金额</span>
                        <span>{{orderMoney}}</span>
                    </p>
                    <span class="circlemark" :class=" stageNum !== null ? stageNum : 0 | stageColor">{{ stageName !== null ? stageName : '' }}</span>
                </div>
            </div>
        </div>
        <div class="thinScroll pr10" v-scrollHeight="94">
            <div>
                <router-link tag="div" :to="{path: routerPath('processEnvironmentorder1'),
                query:{processDetail:item.processDetail,orderNum:item.orderNum,orderMoney:item.orderMoney}}" class="analyItem anItemBor" active-class="anItemBor-active" v-for="(item,index) in orderSum" :key="index" exact>
                    <p class="analyItemTit tx-center">{{item.proname| slice(0,4)}}</p>
                    <p class="analyItemTit tx-center" style="display:none">{{item.orderno}}</p>
                    <div class="analyItemCon">
                        <p class="col-md-4 ">
                            <span class="cLightGray pr8">订单个数</span>
                            <span>{{item.orderNum}}个</span>
                        </p>
                        <p class="col-md-4 ">
                            <span class="cLightGray pr8">订单总金额</span>
                            <span>{{item.orderMoney}}</span>
                        </p>

                    </div>
                </router-link>
            </div>
        </div>
        <div class="pr10">
            <!-- <router-link tag="div" :to="{name:'handerProcess1'}" class="analyItem anItemBor" active-class="anItemBor-active" exact> -->
            <router-link tag="div" :to="routerPath('hander')" class="analyItem anItemBor" active-class="anItemBor-active">
                <p class="analyItemTit tx-center">综合</p>
                <div class="analyItemCon">
                    <p class="col-md-4 ">
                        <span class="cLightGray pr8">总个数</span>
                        <span>{{orderNum}}</span>
                    </p>
                    <p class="col-md-4 ">
                        <span class="cLightGray pr8">总金额</span>
                        <span>{{orderMoney}}</span>
                        <!-- <span>{{totalMoney}}</span> -->
                    </p>
                </div>
            </router-link>
        </div>

    </div>
</template>
<script>
import {
    mapGetters
} from 'vuex'
import { getNewProcess, getExcellentGoodModeratePoor } from '../Resources/Api'
export default {
    data () {
        return {

            orderMoney: 0, // 订单总金额
            orderNum: 0, // 订单总数
            orderSum: [], // 项目list
            orderno: '', // 项目单号
            body: {},
            stageName: '差',
            stageNum: 4

        }
    },
    created () {
        this.getExcellentGoodModeratePoor()
        this.getNewProcessFn()
    // this.GetByRoleOrderListFn()
    // this.getWorkerDetailsFn()
    // this.getValueAddServicesBySupervisionCard()
    },
    methods: {
    // 路由跳转路径拼接
        routerPath (path) {
            return this.$route.matched[1].path + '/' + path
        },
        // 直接进行路由跳转路径
        routerPush (path) {
            this.$router.push(this.$route.matched[1].path + '/' + path)
        },
        // 获取状态中的按钮
        getExcellentGoodModeratePoor () {
            getExcellentGoodModeratePoor({
                user_card_no: this.leftInfo.cardNo,
                standard: 0,
                abilityLevel: this.leftInfo.abilityLevel,
                abilityType: 22
            }).then(results => {
                if (results.data.StatusCode === 0) {
                    this.stageName = results.data.Body.standardName
                    this.stageNum = results.data.Body.userGoodBad
                }
            }).catch(error => {
                console.log(error)
            })
        },
        getNewProcessFn () {
            getNewProcess({
                user_card_no: this.leftInfo.cardNo
            }).then(results => {
                if (results.data.StatusCode === 0) {
                    this.body = results.data.Body
                    this.orderMoney = this.body.orderMoney
                    this.orderNum = this.body.orderNum
                    this.orderSum = this.body.orderSum
                    console.log(this.orderSum)
                }
            }).catch(error => {
                console.log(error)
            })
        }


    },

    filters: {
        stageColor (str) {
            switch (Number(str)) {
            case 1:
                return 'circlemark-green'
            case 2:
                return 'circlemark-lightGreen'
            case 3:
                return 'circlemark-yellow'
            case 4:
                return 'circlemark-lightRed'
            case 5:
                return 'circlemark-purple'
            }
        },
        stageColorStandard (str) {
            switch (str) {
            case '优':
                return 'circlemark-green'
            case '良':
                return 'circlemark-lightGreen'
            case '中':
                return 'circlemark-yellow'
            case '差':
                return 'circlemark-lightRed'
            case '待':
                return 'circlemark-purple'
            }
        }
    },
    computed: {
        ...mapGetters(['leftInfo'])
    },
    watch: {
        leftInfo () {
            // this.GetByRoleOrderListFn()
            // this.getValueAddServicesBySupervisionCard()
            this.getExcellentGoodModeratePoor()
            this.getNewProcessFn()
        }
    }
}
</script>
